home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
gondwana.ecr.mu.oz.au/pub/
/
Graphics.tar
/
Graphics
/
ArtForTheMac.sea.hqx
/
Art Document Text
< prev
next >
Wrap
Text File
|
1992-09-20
|
44KB
|
1,176 lines
The following is extracted from the original art manual page.
DESCRIPTION
Art renders the scene defined in a scene description file,
producing encoded 24 bit raster files as output.
C style comments are supported
and the remainder of a line can be made into a comment by a
# symbol. This version attempts to speed up ray tracing by
using shadow caches, and a kd-tree to do non-uniform spatial
subdivision.
COMMANDS
Including files and variables.
include filename
Includes the file filename in the current file. If the
extension on filename is .frameid the frameid extension
is replaced with whatever the frameid is for the image
(the default is 000, so bloot.frameid will make art
look for a file called bloot.000 is nothing has been
specified on the command line).
varname=expr assigns the expression expr to varname. An
expression can be any mixture of floats, integers, or
character constants of the form 'x' where x is the
character. The variables x, y, and, z are predefined as
the character values 'x', 'y', and 'z', for backward
compatability. The frame number for the frame can be
accessed via the variable frameno. Note: the value in
frameno will only be meaningful if the -f option is
passed an integer.
Setting options.
output type
sets the output format for an image.
e.g. output rle
makes the output image run-length encoded (the default)
without saving alpha information. Other output formats
are rgb, rgba, and rlea. Formats ending in an 'a'
include alpha information in the output file.
twentyfivebit on|off
Starts the ray tracer generating 25 bit rgb values. The
default is off, as it's only for when you need that bit
extra.
maxtreedepth depth
sets the maximum depth for the kd-tree to split to.
e.g. maxtreedepth 35
sets the maxtreedepth to 35 (the default).
maxhitlevel depth
sets the maximum number of rays traced for reflection.
e.g. maxhitlevel 6
sets the maxhitlevel to 6 (the default).
pixelgrid on
sample the image one pixel wider and hider and generate
the picture from averaging the resulting grid of pix-
els. This happens by default if the number of raysper-
pixel is greater than one. Without this option what you
see is what you hit.
raysperpixel
set the number of rays per pixel.
e.g. raysperpixel 4
this value should be an integer number, default is one.
If the number of raysperpixel is greater than one the
pixelgrid is turned on automatically, and the final
pixel value is the average of the grid plus any extra
rays. Generally 4 rays per pixel will remove most
signs of aliasing, with 16 giving a good approximation
to "perfection" (if you have the time!).
antialiasing
this keyword can be followed by the flag adaptive or
brute. If the brute keyword is used the raytracer will
always trace as many rays per pixel as given, if the
adaptive keyword is used the raytracer will trace up to
the number of rays given, but attempts to minimise the
number of rays by checking the local variation where a
ray is being traced.
background
sets the background colour.
e.g. background 0.0, 1.0, 0.0
sets the background colour to green.
falloff
specifies the fall off in the medium. The resulting
intensity for an initial intensity i distance d away is
calculated according to i / (1.0 + falloff * d).
e.g. falloff 0.0
sets the falloff to zero (the default).
ri
sets the world refractive index.
e.g. ri 1.0
sets the refractive index to 1.0 (the default).
fogfactor
specifies a fogfactor. Unless this value is non-zero
the hazecolour and rfactor are ignored. Objects that
are more distant will have the hazecolor blended with
them according to the following equation (derived from
Beer's Law):
I(d) = I(base) * (1 - (1 - rfactor) * exp(fogfactor * d))
A value of 0.00001 would give a slight amount of haze,
while a value of 0.004 gives a very misty picture.
e.g fogfactor 0.0005
sets the fogfactor to 0.0005 (the default is 0).
hazecolour
specifies a hazecolour to be blended with more distant
objects.
eg. hazecolour 0.5, 0.5, 1.0
sets the haze color to a bluish grey. The default is
white.
rfactor
specifies an rfactor for use below in computing haze.
The rfactor is a measure of the fraction of incident
radiation that objects reflect in the atmosphere.
e.g. rfactor 0.3
sets the rfactor to 0.3 (the default).
projection
sets the projection type, either orthographic or per-
spective. The default is perspective. If an ortho-
graphic projection is chosen the screensize keyword
should be used to set the height and width of clipping
window.
lookat
sets the viewpoint and direction by giving a reference
point for the center of the image. A twist around the
line of sight may also be specified. Note: if the up
vector is to be changed up should be used before
lookat.
e.g. lookat(10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 45.0)
puts the eyepoint at (10, 10, 10) looking at the origin
with a 45 degree twist around the line of sight.
up
sets the world up to be something other than the
default (positive y).
e.g. up(0.0, 0.0, 1.0)
specifies that the world up is positive z. Note: this
must be used before lookat.
screensize
specifies the size of the screen the rays originate
from
e.g. screensize 2.0, 2.0
sets it to a sqare 2.0 by 2.0 screen units, centered
around the origin (the default).
fieldofview
specifies the field of view.
e.g. fieldofview 90.0
sets it to 90 degrees (the default). Reducing the field
of view zooms on the center of the image.
title
is used to specify a title to be saved in the image
file. Quotes are required.
e.g. title "Man's inhumanity to man"
provides a good name for any previously untitled work.
sourceradius
(followed by a number) specifies an average source
radius distribution for use with the ripples texture
decribed below.
e.g. sourceradius 100
specifies that the average radius of the centers of the
randomly placed wave sources is 100 unit.
Specifying light sources.
Lights are treated essentially like objects and may be
included in composite objects (such as lamps) so that they
move with the object.
light
is used to define a light source. A point light source
is defined by two attributes: colour and location.
e.g. light {
colour 1.0, 1.0, 1.0
location (-10.0, 40.0, 20.0)
}
defines a white light source of unit intensity at the
point (-10, 40, 20). Lights are treated as point
sources unless a radius is specified using the radius
keyword. The keyword numrays (followed by an integer)
determines the number of rays used to sample the area
light. Non-point lightsources generally lead to softer
shadows. Lights may also be given a direction and an
angle.
e.g. light {
colour 1.0, 1.0, 1.0
direction (10.0, -40.0, -20.0)
angle 20.0
location (-10.0, 40.0, 20.0)
}
defines a light source with light going in the direc-
tion of the origin and a spread of 20 degrees from its
location around its direction vector. If the keyword
insideangle is used then the intensity of the light
will fall of linearly to zero from the inside angle to
the angle of the directional light. A slight falloff
can be introduced inside the inside angle by using the
beamdistribution keyword. This uses the usual beamdis-
tribution function, that is raising the cos of the
angle between the center of the directional light and
the point of interest raised to the beam distribution.
For example:
e.g. light {
colour 1.0, 1.0, 1.0
direction (10.0, -40.0, -20.0)
angle 20.0
insideangle 20.0
beamdistribution 15.0
location (-10.0, 40.0, 20.0)
}
If no angle is specified the light is assumed to be
distant (like sunlight) and to have the same direction
everywhere in the scene. If the light source contains
shadows off
then shadow testing is turned off for that light.
Setting Object Attributes.
Attributes are maintained on an attribute stack. If attri-
butes are not set in the object it will use whatever has
been defined outside the object's scope.
ambient
specifies the amount of ambient light affecting an
object
e.g. ambient 0.1, 0.1, 0.1
Specifies ambient light with colour values r = 0.1,
g = 0.1, and b = 0.1.
material
sets the material properties for the object
e.g. material 0.0, 1.0, 0.0, 0
The numbers in the material are as follows: the refrac-
tive index, the diffuse component, the specular com-
ponent, and the specular exponent. The diffuse com-
ponent represents the percentage of light that will be
reflected diffusely by the object, the specular com-
ponent the amount of light that will be reflected in a
specular fashion. The specular exponent (which is
always truncated down to the nearest integer) deter-
mines how rough the surface is (on a microscopic
level), so the larger this value becomes the smaller
the specular highlights on the object. As a rule the
specular component and diffuse components should add up
to one, and if reflections are being allowed most real-
istic results for a non-transparent objects material
occur when the level of reflectance is the same as the
specular component. Some typical material properties
are chalk (0.0, 1.0, 0.0, 0.0), plastic (0.0, 0.75,
0.25, 20.0), aluminium (0.0, 0.25, 0.75, 6.0). Note:
note for the refractive index to have any effect the
object must have some transparency specified. An
refractive index of 1.5 is a good place to start.
shadows on|off
Specifies whether or not the object is to cast a sha-
dow. The default is on.
tile
specifies a tiling pattern for an object.
e.g. tile filename size 0.25, 0.25
Reads the tiling pattern from filename (another image
file produced by a program using the vort library) and
tiles the object as though the pattern represents an
image 1/4 of the surface area of the object. If tiles
are used through the texture keyword they may also be
rotated, etc, as is sensible. Tiles can be applied to
anything but boxes, geometries, csgs and algebraics.
texture {
texture body
}
specifies a texture for an object. The current texture
types are:
marble
- a marble type texture, basically this texture is
formed by modeling heterogenous layers of differing
materials. Each layer is then perturbed (in the X
direction) by a "turbulent" function to give a streaky
look.
granite
- a granite looking texture, this texture randomly
mixes a "blendcolor" with the base color of the object.
wood - a wood grain looking texture, this texture simulates
wood grain by modeling a tree trunk with randomly per-
turbed concentric cylinders.
wood2
- another wood grain texture, This is similar to "wood"
but the cylinder perturbation is carried out over a
number of octaves to give 1/f perturbation to the
rings.
spotted
- makes funny 'spots' on the object by randomly blend-
ing the colour white with the basecolour
fuzzy
- makes things look fuzzy by randomly perturbing the
objects normal vector.
stucco
- produces a plasted effect by perturbing the objects
normal vector
ripples
- makes what looks likes water ripples. This is done
by summing the contibutions of a set of randomly posi-
tioned wave sources and perturbing the objects normal
verctor.
waves
- makes non-random wave patterns. The user may specify
the position and amplitude etc of a set of wave sources
whose contributions are summed to perturb the objects
normal vector
bumpy
- makes what looks like bumps by randomly perturbing
the objects normal vector.
colourblend
- does a linear colour blend along the y axis.
tile - tiles a preexisting picture onto an object.
The following options can be specified with most of the textures
blend expr
Specify how much of the current texture to blend
with the object colour. For example, we might wish
to blend two tile patterns together so we could
use:
texture tile {
vortfile tile1.pix
blend 0.5 /* Blend %50 of tile1 to object */
}
texture tile {
vortfile tile2.pix
blend 0.75 /* Blend %75 of tile2 to object */
} /* plus tile1 */
blendcolor red, green, blue
Specify a colour to blend with the base colour of
the object. For example, the vein colour in a
marble texture or the ring colour in a wood grain.
colormap filename
Rather than use the blendcolor (see above) colours
may be specified in a colour map file. Instead of
mixing with the base colour, an index into this
colour map is derived from the texture and the
resulting colour from the map is used.
The format of the file is:
number_of_entries - integer
r1, g1, b1 - floats (between 0 and 1)
. . .
. . .
rn, gn, bn
colourmap {
r1, g1, b1,
r2, g2, c2,
. . . ,
. . . ,
rn, gn, bn
}
Instead of specifying a colourmap file as above,
the colourmap entries may be directly specified.
(Remember the commas at the end of all but the
last line).
turbulence expr
Some textures have a turbulent or a noisy character
about them. This parameter attempts to control this
aspect in the texture.
squeeze expr
With the marble and wood textures, the veins for
rings may be made thinner (spacing stays the same)
by increasing this parameter. Usually a maximum
squeeze of no more than 3 or 4 is recomended as
the resultant change is very small above these
values.
scalefactor expr
Some textures require a single scalefactor (eg.
fuzzy, spotted, ripples) that controls the overall
character of the texture. For example, with the
fuzzy texture the scale factor controls 'overall fuzzi-
ness' of the texture. For the spotted texture it
controls the mixing of the white noise with the
objects basecolour.
scalefactors expr, expr, expr
Some textures require more than one scalefactor.
(eg. bumpy - where each component of the normal pertur-
bation may be controlled, and colourblend, where the
first value is a start point along y, the second the
distance you want to blend over, and the third the tur-
bulance) In fact, for the textures that do not
explicitly require a scalefactors field, the first
value equates to a "size" scale for the texture,
the second to the turbulence, and the third to the
squeeze. This gives a shorthand way of specify in some
parameters and is backwardly compatible with older
versions of art.
source {
wave source specification
}
The waves texture should have one or more wave
sources defined. The location of each wave source
is given by the center(x, y,
z)keyword.Otherparametersfora
wavelength expr
phase expr
damping expr
amplitude expr
all of which have their traditional meanings.
Textures are applied in the object's canonical space and are
automatically scaled by the object's size unless specified
outside the scope of the object. Tiles appearing in textures
are applied in the object's canonical space. Canonical
spaces for objects are as follows:
boxes, cylinders, cones
- bottom z equals zero, top z equals one.
spheres, ellipsoids, superquadrics
- unit radius centered at the origin.
rings and torii
- unit radius, lying in the xy-plane, facing z.
polygons
- lying in the positive xy-plane, one corner at (0, 0,
0), scaled to a unit square.
Additionally transformations such as rotation, etc... can
also be used in textures. These transformations are applied
after the viewing and, if the texture is defined in the
object's scope, the object transformation. For example:
texture tile {
size 0.25, 0.25
vortfile tile.pix
rotate(45, y)
}
will tile an object with the tile pattern rotated in object
space by 45 degrees around y. Examples
texture marble {
blendcolour 0.4, 0.1, 0.1
turbulence 30
squeeze 2
rotate(90.0, x)
range 6
}
texture waves {
source {
center(0, 0, 0)
amplitude 1
wavelength 2
}
source {
center(1, 0, 0)
amplitude 0.5
wavelength 2.5
damping 0.2
}
}
texture fuzz scalefactor 0.2
texture wood {
rotate(90, y)
turbulence 2
squeeze 2
blendcolor 0.2, 0.2, 0.2
}
texture marble {
rotate(60, z)
translate(0.2, 0.2, 0.2)
turbulence 3
colourmap {
1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0
}
texture tile vortfile lenna.pix
texture tile {
rotate (90, z)
vortfile lenna.pix
blend 0.5
}
The tile texture needs to be given a size if the default
(1.0, 1.0) is not wanted. The pixel file being used is
specified using the vortfile keyword. Textures may also be
used to modulate different surface attributes other than
colour. For example, a texture may be used to modulate the
transparency of an object. This is done by specifying the
attribute to modulate then a texture specification as
described above. For example:
transparency texture marble {
blendcolor 1, 1, 1
turbulence 2
}
would modulate the transparency of an object.
polygon {
material 1, 0.5, 0.5, 10
vertex(-1, -1, 0)
vertex(-1, 1, 0)
vertex(1, 1, 0)
vertex(1, -1, 0)
transparency texture tile {
vortfile lenna.pix
}
}
would produce a polygon with a transparent image on it -
similar to a slide. Attributes that may be modified with
textures are:
transparency - the colour returned from the texture function
is used to set the transparency values of the object.
ambient - the colour returned from the texture function is
used to set the ambient values of the object.
reflectance - the colour returned from the texture function
is used to set the reflectance values of the object.
ri - the grayscale equivalent of the colour returned from
the texture function is added to the refractive index
of the object.
colour
specifies the object's colour.
e.g. colour 1.0, 1.0, 1.0
makes an object white. The word color can also be used.
reflectance
sets the amount of reflectance for an object.
e.g. reflectance 0.75
indicates that 75% of the light coming from an object
is reflected from somewhere else.
transparency
set the transparency of an object.
e.g. transparency 0.75
indicates that 75% of the light behind an object is
transmitted through it. Transparent objects will look
washed out if the diffuse component is too high and the
specular component too low. For example a glass object
might have the following properties:
meterial 1.5, 0.1, 0.9, 100
transparency 0.9
reflectance 0.1
absorption
set the absorption factor for an object.
e.g. absorption 0.35
indicates that 35% of the light coming from an object
is absorbed per unit of length in world units. Tran-
sparency must be used also for this to be effective.
Defining Objects.
sphere
defines a sphere. The radius and the centre must be
given.
e.g. sphere {
colour 1.0, 0.0, 0.0
material 0.0, 0.25, 0.75, 6.0
reflectance 0.75
center (-2.0, -0.5, -6.0)
radius 1.1
}
ellipsoid
defines an axis-aligned ellipsoid. The center of the
ellipsoid and the radii for each axis need to be speci-
fied. The usual set of transformations may be applied
to an ellipsoid when a non axis-aligned object is
required.
e.g. ellipsoid {
colour 0.7, 0.5, 0.5
material 0.0, 1.0, 0.0, 0.0
rotate(45.0, x)
center (0.0, 0.0, 0.0)
radii 1.5, 0.5, 6.0
}
box
defines an axis-aligned box. It requires the top-
front-right and the bottom-back-left corners to be
specified. The usual set of transformations may be
applied to a box when a non axis-aligned object is
required.
e.g. box {
colour 0.7, 0.5, 0.5
material 0.0, 1.0, 0.0, 0.0
vertex (2.5, 2.5, -5.0)
vertex (1.5, 0.5, -6.0)
}
cylinder
defines a cylinder. The centers of the two faces are
needed together with the radius. An elliptic cylinder
can be defined by using radii (e.g. radii 2.0, 1.0)
instead of radius.
e.g. cylinder {
colour 1.0, 0.0, 0.0
material 0.0, 0.75, 0.25, 6.0
center (0.0, 4.0, -6.0)
center (0.0, -3.5, -6.0)
radius 2.5
}
cone
defines a cone. The tip of the cone plus the center of
its face and its radius is needed. Elliptic cones will
be generated if radii is used. If another center and
rdaius are provided instead of the vertex a truncated
cone is generated instead.
e.g. cone {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
vertex (0.0, 20.0, 0.0)
center (0.0, 0.0, 0.0)
radius 5.5
}
torus
defines a right circular torus. The definition requires
the center of the torus and values for the radius of
the torus and the radius of its pipe. Unless a rota-
tion, via rotate, is specified all torii have their
major axis in a plane parallel to the (x, y) plane.
e.g. torus {
colour 1.0, 0.0, 0.0
material 0.0, 0.95, 0.00, 0.0
center (0.0, 0.0, 0.0)
radius 3.0
radius 2.0
}
polygon
describes a polygon by specifying the vertices of the
polygon. If a tile pattern is defined the first vertex
specified is used to map the tile pattern onto the
polygon.
e.g. polygon {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
tile rb.pix size 0.5, 0.5
vertex (-2.0, -0.7, -2.0)
vertex (2.0, -0.7, -2.0)
vertex (2.0, -0.7, 2.0)
vertex (-2.0, -0.7, 2.0)
}
describes a four sided polygon. In the case of 3 and
most 4 sided polygons additional surface normals and
colours can be specified that will be interpolated from
the polygons vertices. The following example shows
where both have been added, the second set of numbers
in parentheses is the normal at that vertex, the third
set of numbers is the colour at that vertex. The nor-
mals and colours may be specified in any order, and
don't need to be specified together. Note: if the
polygon is 4 sided a base colour for it must be defined
as the interpolation works by dividing the polygon up
into triangles, generally this base colour should be
the average of the normal colours, although interesting
results can be obtained when it isn't.
e.g. polygon {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
tile rb.pix size 0.5, 0.5
vertex (-2.0, -0.7, -2.0), (0, 1, 0), 1.0, 0.0, 0.0
vertex (2.0, -0.7, -2.0), (0, 1, 1), 0.0, 1.0, 0.0
vertex (2.0, -0.7, 2.0), (0, 1, -1), 0.0, 0.0, 1.0
}
disk
describes a disk.
e.g. disk {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
center (0.0, 0.0, 0.0)
radius 1.0
}
describes a disk of unit radius at the origin, in the
(x, y) plane. If an elliptical disk is required radii
can be used instead of radius. Disks can be transformed
as required.
ring
describes a ring.
e.g ring {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
center (0.0, 0.0, 0.0)
radius 1.0
radius 0.5
}
describes a ring of unit radius at the origin, in the
(x, y) plane, with a hole in it radius of 0.5. If an
elliptical ring is required radii can be used instead
of radius. Rings can be transformed as required.
geometry
describes a multi-faceted object. If the object is a
polyhedron it can be used in csg modeling. Geometry
objects can be a set of polygons defined in a geometry
file, a strip of triangles or a heightfield. They may
be phong shaded and backfaced if required. It is noted
that some things are not designed with backfacing in
mind.
e.g. geometry {
colour 1.0, 0.0, 0.0
material 0.0, 0.25, 0.75, 6.0
phongshading on
backfacing on
offfile goblet.geo
}
If phong shading is not specified the geometry model is
flat shaded. Currently only offfiles (files in the
"object file format") and strips are supported by the
geometry option. The offiles describing the colour of
individual polygons, the vertex normals, the vertex
colours, and the polygon normals may also be included
in the geometry, their keywords are colourfile, vnor-
malfile, vcolourfile, and normalfile respectively.
The triangle strips are introduced using the strip key-
word. In its most basic form a strip which defines two
triangles would look as follows:
e.g. geometry {
strip {
(-9.523, 10.625, -7.842)
(-8.662, 9.543, -9.554)
(-9.435, 10.241, -7.556)
(-8.574, 9.159, -9.267)
}
}
Each line defines a vertex. The first triangle is com-
posed of the first three vertices, and the second the
last three. The surface normals for each of the trian-
gles are reversed for every second one (i.e they are
calculated 1, 2, 3, then 4, 3, 2, then 3, 4, 5....), so
that strips can be backfaced sensibly.
It is also possible to associate vertex colours with a
strip:
e.g. geometry {
strip {
(-9.523, 10.625, -7.842), 1.0, 0.0, 0.0
(-8.662, 9.543, -9.554), 0.0, 1.0, 0.0
(-9.435, 10.241, -7.556), 1.0, 0.0, 0.0
(-8.574, 9.159, -9.267), 0.0, 0.0, 1.0
}
}
In this case each line defines a vertex, vertex-colour
pair.
Two formats of heightfields are supported, the first is
a binary file with an int at the front giving the
dimension of the grid followed by a list of z values
(floats), the second is a binary file of z values
(floats) that begins with one line of text.
e.g. HEIGHTFIELD xdim ydim
<floats>.....
where xdim, and ydim are the dimensions (eg. 640 480).
The height field described in the file is assumed to be
in the range 0 to 1 in it's longest dimension.
e.g. geometry {
colour 1.0, 0.0, 0.0
material 0.0, 0.25, 0.75, 6.0
phongshading on
heightfield land.hf
}
Heightfields may also be tiled with an image or
coloured using a colorfield. A colorfield is a binary
file of rgb values (all floats) that begins with one
line of text.
e.g. COLORFIELD xdim ydim
<floats>.....
where xdim, and ydim are the dimensions (eg. 640 480).
It is assumed that the colorfield has the same dimen-
sions as it's corresponding heightfield.
superquadric
is used to define a superquadric surface. Superquadrics
are basically boxes with curved edges, with a superqua-
dric of order 1 looking like a diamond with 8 facets.
They are defined as a bounding box and an order.
e.g. superquadric {
colour 1.0, 0.0, 0.0
material 0.0, 0.95, 0.0, 0.0
vertex (3.0, 9.0, 3.0)
vertex (-3.0, 3.0, -3.0)
order 1.0
}
algebraic
is used to describe an algebraic surface. Currently the
maximum order for a surface is 12 (MAX_ORDER in
poly.h). The equation for the surface is in TeX format.
e.g. algebraic {
colour 1.0, 0.0, 0.0
material 0.0, 0.95, 0.00, 0.0
equation $$ x^{2} + y^{2} + z^{2} - 1 = 0 $$
}
describes a sphere of unit radius.
The area of the surface being looked at can be res-
tricted by using a clip volume (as well as csg, defin-
ing a clipping volume is faster). Clip volumes may be
spheres, cylinders, or boxes. The following is an exam-
ple of the use of a clip volume.
algebraic {
colour 1.0, 0.0, 0.0
material 0.0, 0.95, 0.00, 0.0
equation $$
x^{4} + y^{4} + z^{4} + 1
- x^{2} - y^{2} - z^{2}
- y^{2}z^{2} - z^{2}x^{2} - x^{2}y^{2}
= 0
$$
clipvolume box {
vertex (3.0, 3.0, 3.0)
vertex (-3.0, -3.0, -3.0)
}
}
composite
is used to specify a composite object. This construct
is still a bit restricted but is useful if a bunch of
related objects need to be transformed in the same way.
Composites cannot be used in csg modeling.
e.g. composite {
rotate(45.0, y)
colour 1.0, 0.0, 0.0
material 0.0, 0.95, 0.00, 0.0
sphere {
center(0.0, 0.0, 0.0)
radius 1.0
}
sphere {
center(0.0, 0.0, 2.0)
radius 0.5
}
}
csg
is used to specify a CSG model. Constructive solid
geometry operations may be applied to any of the above
except where stated otherwise. The syntax for the CSG
operations are: + for union, - for subtract, and * for
intersect. CSG requires the naming of the objects mak-
ing up the model. Other CSG objects can be included in
the model definition.
e.g. csg {
sphere s1 {
colour 0.8, 0.1, 0.0
material 0.0, 0.95, 0.05, 6.0
center (1.7, 3.1, -4.5)
radius 2.0
}
sphere s2 {
colour 0.8, 0.1, 0.0
material 0.0, 0.95, 0.05, 6.0
center (4.7, -1.7, -4.5)
radius 2.0
}
box b1 {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
vertex (4.5, 2.5, -5.0)
vertex (1.5, -1.5, -8.0)
}
(b1 - s1) - s2
}
Note that it is wise to allow some room for numerical
error when doing a csg subtract. The following will not
always work:
csg {
box b1 {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
vertex (4.5, 2.5, -5.0)
vertex (1.5, -1.5, -8.0)
}
box b2 {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
vertex (4.5, 2.0, -4.0)
vertex (1.5, -1.0, -7.0)
}
(b1 - b2)
}
whereas:
csg {
box b1 {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
vertex (4.5, 2.5, -5.0)
vertex (1.5, -1.5, -8.0)
}
box b2 {
colour 1.0, 0.0, 0.0
material 0.0, 1.0, 0.0, 0.0
vertex (5.5, 2.0, -4.0)
vertex (0.5, -1.0, -7.0)
}
(b1 - b2)
}
will, (hint: look at the definition for b2).
Repeating Objects in a scene.
If an object is created with a name (as in csg) then the
object will not appear in the scene unless the name of it is
used elsewhere in the file as an object type. This can be
useful if you have a composite object which you wish to
define several occurances of, for example:
composite com {
colour 1.0, 1.0, 1.0
.
.
.
}
com {
translate(-10, 0, 0)
}
com {
translate(10, 0, 0)
}
puts two 'com' objects in the scene which are tranlated ver-
sions of the original ones.
Alternatively the repeat statement can be used to provide
more than one occurance of an object.
repeat 4 {
translate(5, 0, 0)
com
}
creates four occurances of the object com with each one
occuring a further 5 units along in positive x.
Transformations.
Three transformations may be applied, rotate, scale, and
translate, as well as a more general transformation matrix.
As with object attributes, matrices live in a stack so a
transformation applied outside the scope of an object will
apply to that object, in addition to any transformations
that may be specified in the object itself.
translate
Translation can be applied to any primitive.
e.g. translate(1.0, 0.0, 0.0)
shifts the object in x by 1.0.
rotate
Rotation can be applied to any primitive.
e.g. rotate(90.0, x)
rotates the object 90 degrees around x.
scale
Scaling may be done on any primitive.
e.g. scale(2.0, 2.0, 2.0)
scales the object by 2.
transform
The transform keyword can be used to introduce a 4 x 3
transformation matrix.
e.g. transform {
R11, R12, R13,
R21, R22, R23,
R31, R32, R33,
TX, TY, TZ
}
The R values represent rotations (possibly with an a
scaling vector applied) and the T values represent
translation. Strictly speaking this is treated as a 4 x
4 but the last column is always assumed to be (0, 0, 0,
1).
BUGS
While the twentyfive bit mode does set the twenty fifth bit
it doesn't seem to change the picture quality.
On the IBM PC, you can't have more than 5450 vertices and
1300 polygons in a geometry file.
SEE ALSO
disp(1), vortinfo(1), targ2vort(1), vort2ps(1), median(1),
mulmcut(1), greyscale(1), gamma(1), movie(1), dart(1),
nart(1), vort(3).